// (c) 2008 Kickstone Technology Ltd

#pragma once
#include "dispatchimpl.h"
#include "WebBrowserEventCallback.h"

class CButtonDemoBHO;

class CWebBrowserEventSink : public CDispatchImpl {
public:
	CWebBrowserEventSink(IWebBrowserEventCallback *bho);
	~CWebBrowserEventSink();

	bool advise(IWebBrowser2 *pBrowser);
	bool unadvise();

private:
	// CDispatchImpl functions
	HRESULT handleEvent(DISPID dispIdMember, DISPPARAMS *pDispParams);
	void finalRelease();

	IWebBrowserEventCallback *m_BHO;

	DWORD m_dwCookie;   // Connection Token - used for Advise and Unadvise

	CComPtr<IWebBrowser2> m_spWebBrowser2;

};
